package ar.mobileideas.mobiletasks.app.ui;

import ar.mobileideas.mobiletasks.utils.TableLayoutManager;
import net.rim.device.api.system.PersistentObject;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.ListField;
import net.rim.device.api.ui.component.TextField;
import net.rim.device.api.ui.container.MainScreen;

public class TasksScreen extends MainScreen {

	/**
	 * 
	 */
	public TasksScreen(String tasksTypeTitle) {
		super(MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLLBAR);
		this.setTitle("Tareas " + tasksTypeTitle);

		this.LoadTasks();
	}

	private void LoadTasks() {
		TableLayoutManager outerTable = new TableLayoutManager(new int[] {
				TableLayoutManager.USE_PREFERRED_SIZE,
				TableLayoutManager.SPLIT_REMAINING_WIDTH },
				TableLayoutManager.VERTICAL_SCROLL);

		for (int i = 0; i < 10; i++) {
			TableLayoutManager innerTable = new TableLayoutManager(
					new int[] { TableLayoutManager.USE_PREFERRED_SIZE },
					Manager.VERTICAL_SCROLL);

			LabelField titleField = new LabelField("Nombre de tarea "+ i );
			LabelField descriptionField = new LabelField("Prioridad de tarea " + i);
			LabelField descriptionFieldLink = new LabelField("Area de tarea " + i);
			ButtonField botonVer = new ButtonField("Details");

			innerTable.add(titleField);
			innerTable.add(descriptionField);
			innerTable.add(descriptionFieldLink);
			innerTable.add(botonVer);
			outerTable.add(new LabelField("Task " + i));
			outerTable.add(innerTable);
		}

		this.add(outerTable);

	}

}
